package com.fxsh168.server.otherviews.banner;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.fxsh168.server.R;


public class AdvertisementActivity extends AppCompatActivity {
    private WebView advertisementWeb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_advertisement);
        initViews();
    }

    private void initViews() {
        String linkPath = getIntent().getStringExtra("linkPath");
        advertisementWeb = (WebView) findViewById(R.id.advertisement_web);
        WebSettings settings = advertisementWeb.getSettings();
        settings.setJavaScriptEnabled(true);
        advertisementWeb.loadUrl(linkPath);
        advertisementWeb.setWebViewClient(new mWebViewClient());}

    /**
     * WebView监听
     */
    class mWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }

}
